package com.ant4j.popularize.ui;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
/**
 * @description:慧蚁淘宝客推广软件启动主程序入口
 * @author: <a href="mailto:hnxyhcwdl1003@163.com">wandalong</a>
 * @date: 2013-4-5
 */
@SuppressWarnings("serial")
public class MainFrame extends JFrame {
	
	private static MainFrame mainFrame = null;

	private MainFrame() {
		this.setTitle("[慧蚁淘宝客推广]-V1.0.0");

		/*Dimension d = this.getToolkit().getScreenSize();
		int w = (int) d.getWidth();
		int h = (int) d.getHeight() - 30;*/
		this.setMinimumSize(new Dimension(950,600));
		this.setResizable(false);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setLocationRelativeTo(null);
		
		MainPanel panel = new MainPanel();
		Container contenpane = this.getContentPane();
		contenpane.add(panel, BorderLayout.CENTER);
		this.setVisible(true);
	}

	public static void main(String[] args) {
		
		try {       

		        //将界面风格设置为系统风格
		      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		     } catch (Exception e) {
		    e.printStackTrace();
		   }

		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				
				System.out.println("dddddd");
				//DBUtil.getInstance();
				
				//new LoginDialog();
				JDialog.setDefaultLookAndFeelDecorated(true);
				JFrame.setDefaultLookAndFeelDecorated(true);
				MainFrame.getInstance();
				//mainFrame.setVisible(true);
			}
		});
	}

	public static MainFrame getInstance() {
		return mainFrame == null? new MainFrame() : mainFrame;
	}
}
